/**
 Copyright (C) 2013 Yuyao Liang

 This source code is release under the BSD License.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.

 Created on Oct 23, 2013 4:07:50 PM
 */
package com.google.srclib.stock;

import java.io.IOException;
import java.sql.SQLException;
import java.util.zip.ZipOutputStream;

import com.google.srclib.io.zip.Zipper;

/**
 * @author lianyuy
 * 
 */
public class StockSymbolsUpdater {

	public static void _updateSymbols(String zipcvsfilename,
			String[] exchangenames) {
		try {

			StockSymbolDataSet[] ss = StockCodeCollector.getInstance()
					.getSymbolList(exchangenames);
			Zipper zipper = Zipper.getInstance();
			ZipOutputStream zout = zipper.makeZipFile(zipcvsfilename); //$NON-NLS-1$
			for (int i = 0; i < ss.length; i++) {
				zipper.csvWriter(zout, ss[i], exchangenames[i] + ".csv"); //$NON-NLS-1$
			}
			zout.close();

		} catch (SQLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
